#@bootStrapLayout("登录界面")

#define bootStrapMain()
<div class="login-container">
    <div class="col-md-12" >
        <div class="col-md-5"><h2>云悠旅行-商户平台</h2></div>
        <div class="col-md-6">
            <div style="margin-top:15%">
                <form class="form-horizontal" id="submitForm">
                    <div class="form-group">
                        <label for="title" class="col-sm-2 control-label login-text">用户帐号</label>
                        <div class="col-sm-6">
                            #@textInput("text","userName","title","请输入用户帐号信息...",article.title??'')
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="password" class="col-sm-2 control-label login-text">用户密码</label>
                        <div class="col-sm-6">
                            #@textInput("password","userPass","password","请输入用户密码信息...",article.title??'')
                        </div>
                    </div>
                    <div class="form-group">
                        <div  style="text-align: center">
                            <button type="button" id="loginBtn" class="btn btn-primary">登录</button>
                            <button type="reset" id="resetBtn" class="btn btn-default">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
#end

#define bootStrapCss()
<link rel="stylesheet" href="#(contextPath)/assets/front/css/login.css">
#end

#define bootStrapJs()
<script>

    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return "";
    }

    $("#loginBtn").click(function(){
        $.ajax({
            "url":"#(contextPath)/travel/doLogin",
            "method":"post",
            "data":$("#submitForm").serialize(),
            "success":function(resp){
                if(resp.result){
                    var returnUrl = getQueryString("returnUrl");
                    returnUrl = decodeURIComponent(returnUrl)
                    if(returnUrl!=""){
                        window.location.href=returnUrl;
                    }else{
                        window.location.href='#(contextPath)/travel'
                    }
                }else{
                    layer.msg(resp.data);
                }
            }
        })
    });
</script>
#end